Repository navigation
feat: AI 톤 교정 준비 - 출력 토큰 수 · 회원 존재 확인 · 에러 코드 · 요청 검증 (#65 1/3) - #85
Merged
Merged
Conversation
This was referenced Nov 10, 2026
oTAETAEo
approved these changes
Nov 12, 2026
| if (text == null || TextWhitespace.isBlank(text)) { | ||
| return reject(context, AiErrorCode.TEXT_EMPTY); | ||
| } | ||
| if (text.length() > MAX_LENGTH) { |
Contributor
There was a problem hiding this comment.
원문 길이를 정규화 없이 세는 건 본문에 적어 주셔서 확인했는데, 화면 톤 교정 입력창도 같은 기준으로 세는지만 프론트랑 맞춰 보면 좋을 것 같아요 !
Contributor
Author
There was a problem hiding this comment.
서버는 String.length() 기준이라 이모지는 2자, 줄바꿈은 1자로 셉니다. 프론트에서 입력창 최대 길이 속성이나 value.length로 세면 같은 기준이라 어긋나지 않을 것 같은데, 프론트에 한번 확인해 보겠습니다!
| * @param outputTokens 출력 토큰 수 (생각 토큰 포함). 응답에 없으면 0 | ||
| */ | ||
| public record LanguageModelResult(String text, boolean refused) { | ||
| public record LanguageModelResult(String text, boolean refused, int outputTokens) { |
Contributor
There was a problem hiding this comment.
LanguageModelResult에 필드를 추가한global변경
좋은 것 같아요 ! global이 도메인을 참조하지 않고, usage나 output_tokens가 없어도 0으로 받아서 응답 처리가 깨지지 않는 것 확인했습니다 👍
|
|
||
| /** | ||
| * 요청 객체의 문체 검증. null·빈 값·ToneStyle 상수 이름과 정확히 같지 않은 값(소문자 포함)이면 AI400_1. | ||
| * 요청 필드를 ToneStyle로 받으면 없는 값이 JSON 변환 실패(COMMON400_1)가 되므로, 문자열로 받아 이것으로 검사한다. |
Contributor
There was a problem hiding this comment.
@ValidToneStyle을 문자열로 받는 판단
적절한 것 같아여ToneStyle로 바로 받으면 없는 값이 JSON 변환 실패로 COMMON400_1이 돼서, 명세의 "style 누락 또는 값 오류 → AI400_1"을 못 맞추는 걸로 이해했습니당 대소문자까지 정확히 비교하는 것도 명세 값과 맞습니다아
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
관련 이슈
작업 내용
#65가 약 1,220줄이라 세 PR로 나눴습니다. 순서대로 병합해 주세요.
① 준비 #85 (이 PR, develop 대상) → ② 서비스 #86 (① 브랜치 대상) → ③ API·문서 #87 (② 브랜치 대상)
global/client/llm, 디스코드 공유함)LanguageModelResult(text, refused, outputTokens)usage.output_tokens를 읽음.usage나 값이 없으면 0 (잭슨 3에서 원시 타입 누락으로 실패하지 않게Integer로 받음)FakeLanguageModelClient는 0UserQueryService.validateActive(Long userId)USER404_1AiErrorCode에 AI400_1~3, AI422_1, AI502_1, AI504_1 추가 (문구는 명세 그대로)domain/ai/annotation)@ValidToneStyle:ToneStyle상수 이름과 대소문자까지 같을 때만 통과. 아니면 AI400_1 (요청 필드를 열거형으로 받으면 없는 값이 JSON 변환 실패로COMMON400_1이 되기 때문)@ValidToneText: null·빈 값·공백만(TextWhitespace기준, NBSP·BOM 포함)이면 AI400_2,String.length()3000 초과면 AI400_3. 정규화하지 않고 받은 그대로 셈명세와 달라진 점
없음
테스트
usage없음·output_tokens없음·usage: null이면 0이고 결과는 정상, 가짜 구현은 0USER404_1@ValidToneStyle: 6개 문체 통과, null·빈 값·공백·ESSAY·소문자·앞뒤 공백·없는 값은 AI400_1@ValidToneText: null·빈 값·공백만(NBSP·BOM·전각 공백·줄바꿈)은 AI400_2, 3000자 통과·3001자 AI400_3, 자모 분리형도 받은 그대로 셈확인 체크리스트
./gradlew build통과global공통 코드를 바꿨다면 디스코드에 공유함 (global/client/llm출력 토큰 수)리뷰어에게
[중점]
LanguageModelResult에 필드를 추가한global변경,@ValidToneStyle을 문자열로 받는 판단